import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router, Params, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/internal/operators';

interface IBreadcrumb {
  label: string;
  params: Params;
  url: string;
}

@Component({
  selector: 'app-breadcrumb',
  templateUrl: './breadcrumb.component.html',
  styleUrls: ['./breadcrumb.component.scss']
})
export class BreadcrumbComponent implements OnInit {
  public breadcrumbs: IBreadcrumb[];
  constructor(
    private activatedRoute: ActivatedRoute,
    private router: Router,
  ) {
    this.breadcrumbs = [];
  }

  ngOnInit() {
    // const ROUTE_DATA_BREADCRUMB = 'breadcrumb';
    // this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(event => {
    //   console.log(event, 'gregejhe');
    //   const root: ActivatedRoute = this.activatedRoute.root;
    //   this.breadcrumbs = this.getBreadcrumbs(root);
    // });
    this.activatedRoute.data.subscribe(res => console.log(res, 'gerkghker'));
  }

  // private getBreadcrumbs(route: ActivatedRoute, url: string = '', breadcrumbs: IBreadcrumb[] = []): IBreadcrumb[] {

  //   return [];
  // }

}
